/************************************
 * Package: RGcpp					*
 * Authors: Rui Eduardo Gouveia Gil	*
 * Date: 2010						*
 ************************************/
#include "rgcpp/net/http/HTTPRequest.h"

namespace rgcpp
{

bool HTTPRequest::request(const std::string& url)
{
	CURL* handler = curl_easy_init();
	if(!handler)
		return false;

	curl_easy_setopt(handler,CURLOPT_HTTPGET,1);
	curl_easy_setopt(handler,CURLOPT_NOPROGRESS,0);
	curl_easy_setopt(handler,CURLOPT_URL,url.c_str());
	curl_easy_setopt(handler,CURLOPT_CUSTOMREQUEST,NULL);

	bool result = (curl_easy_perform(handler)==0);

	curl_easy_cleanup(handler);

	return result;
}

}
